package com.lyn.common.base;

public class Result {
    private static final int OK_CODE = 10000;
    private static final int FAIL_CODE = 90000;

    private int code;
    private String msg;
    private Object data;



    public static Result create() {
        return new Result();
    }

    public static Result ok(String msg) {
        return create().setCode(10000).setMsg(msg);
    }

    public static Result ok(String msg, Object data) {
        return create().setCode(10000).setMsg(msg).setData(data);
    }

    public static Result fail(String msg) {
        return create().setCode(90000).setMsg(msg);
    }



    public int getCode() {
        return code;
    }

    public Result setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Result setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Object getData() {
        return data;
    }

    public Result setData(Object data) {
        this.data = data;
        return this;
    }
}
